clear
cd "/Users/Kristina/Documents/Documents/kristina_school/Pol_Projects/PEW.2002.2007.threat"
use "2007LatinoSurvey_final_data_publicrelease.dta"


******************************************************************
* Kristina Victor
* Date Started: February 8, 2012
* Project: Pew Hispanic Center Recode
******************************************************************



* Using the 2007 Pew Hispanic Center Survey

set more off

* Dropping labels to avoid confusion in labeling after recodes
label drop _all

* Drop observations for non-Latinos
drop if qn1==2
drop if qn1==9



****************************************************************
* 															   *
* 				Demographic Variables Recode				   *
*															   *
****************************************************************


* Recode Gender 1=female, 0=male

gen female=1 if qnd18==2
	replace female=0 if qnd18==1
	label variable female "gender, 1=female" 

* Heritage variables and birthplace variables

gen USborn=qn5
	recode USborn (1=1) (2=0) (3=0) (98=.) (99=.)
	label variable USborn "Born in US, excl Puerto Rico"


gen USPRborn=qn5
	recode USPRborn (1=1) (2=1) (3=0) (98=.) (99=.)
	label variable USPRborn "Born in US or Puerto Rico"


*US Citizen or not

gen citizen=qn9
	recode citizen (1=1)(2=0)(3=0) (8=.) (9=.)
	replace citizen=1 if USPRborn==1
	label variable citizen "1 if US citizen"


* Married

gen married=qn48
	recode married (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (8=.) (9=.)
	label variable married "1 Married, 2 Have partner, 3 Widowed, 4 Divorced, 5 Separated, 6 Never Been Married"


* Age

gen age=qn50
	recode age (99=.)

* Education 

gen education=qn51
	recode education (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (7=7) (8=8) (9=.)
	label variable education "1 None or grades 1-8, 2 High School Incomplete, 3 High School, 4 GED, 5 Business or Tech, 6 Some College, 7 College, 8 Post-graduate"

* Education variable with 3 categories

gen education=qn51
	recode education (9=.) (1=1) (2=1) (3=1) (4=1) (5=2) (6=2) (7=3) (8=3)
	label variable education "1 High school or less, 2 Some tech or college, 3 college or graduate"
	

	
* Employed 

gen employed=qn52
	recode employed (1=1) (2=1) (3=0) (8=.) (9=.)
	label variable employed "1 Employed Full or Part Time, 0 Other"
	
	
* Income with Categories

gen incomecats=. 
	replace incomecats=1 if qn57==1
	replace incomecats=2 if qn57==2
	replace incomecats=3 if qn57==3
	replace incomecats=4 if qn57==4
	replace incomecats=5 if qn57==5
	replace incomecats=6 if qn57==6
	replace incomecats=7 if qn58==1
	replace incomecats=8 if qn58==2
	replace incomecats=9 if qn58==3
	replace incomecats=10 if qn58==4
	replace incomecats=11 if qn59==1
	replace incomecats=12 if qn59==2
	replace incomecats=13 if qn59==3
	replace incomecats=14 if qn59==4
	replace incomecats=15 if qn59==5
	replace incomecats=16 if qn59==6 
	label variable incomecats "1 5K, 2 5-10K, 3 10-15K, 4 15-20K, 5 20-25K, 6 25-30K, 7 30-35K, 8 35-40K, 9 40-45K, 10 45-50K, 11 50-60K, 12 60-75K, 13 75-100K, 14 100-150K, 15 150-200L, 16 200+"
	
* Spanish Dominant

gen spdominant=1 if primary==3
	replace spdominant=0 if primary~=3
	label variable spdominant "1 Spanish Dominant, 0 Bilingual or English"
	
* Number of adults living in the household:

gen adults=qn61
	recode adults (98=.) (99=.)

* The region of the country where respondent resides:

rename sample03 region

* The metro status of the respondent:

rename sample14 metro


****************************************************************
* 
* 						Attitudinal Items					   *
*
****************************************************************

*How confident are you that Latino children growing up now in the US will have*/
*better jobs and make more money than you?*/

gen childbetter=qn11
   recode childbetter (1=1) (2=2) (8=3) (3=4) (4=5) (9=.)
   label variable childbetter "1= Very Confident, 2=Somewhat, 3=Don't Know, 4=Somewhat Confidnet, 5=Not At All Confident"

* Party ID

gen pid2=qn17
   recode pid2 (1=1) (2=3) (3=2) (7=4) (8=5) (9=6)
   label variable pid2 "1 Rep, 2 Ind, 3 Dem, 4 Something Else, 5 Don't Know, 6 Refused"

* Amount of immigrants

gen amount=qn24
	recode amount (3=2) (2=3) (8=.) (9=.)
	label variable amount "1 Too Many, 2 Right Amount, 3 Too Few"

* Do immigrants help or hurt
	
gen helphurt=qn26
	recode helphurt (1=0) (2=2) (8=1) (9=.)
	label variable helphurt "2 Hurt, 1 don't know, 0 help"



**************************************************************** 
*
* 					Discrimination Questions				   *
*
****************************************************************


* Discrimination in schools

recode qn28a (1=3) (2=2) (3=1) (8=.) (9=.)
	gen discrimschools=qn28a
	label variable discrimschools "1 Not a Problem, 2 Minor Problem, 3 Major Problem"


* Discrimination at work

recode qn28b (1=3) (2=2) (3=1) (8=.) (9=.)
	gen discrimwork=qn28b
	label variable discrimwork "1 Not a Problem, 2 Minor Problem, 3 Major Problem"

* Discrimination in general

recode qn28c (1=3) (2=2) (3=1) (8=.) (9=.)
	gen discrimgeneral=qn28c
	label variable discrimgeneral "1 Not a Problem, 2 Minor Problem, 3 Major Problem"

egen discrimscale= rsum(discrimgeneral discrimschools discrimwork)

**************************************************************** 
*
* 			Ethnic and Racial Backround Questions			   *
*
****************************************************************


* Ethnic Respect 

gen ethrespect=qn30a
	recode ethrespect (1=4) (2=3) (3=2) (4=1) (8=.) (9=.)
	label variable ethrespect "4 Very Often, 3 Fairly, 2 Once in a While, 1 Never"

* Ethnic Service 

gen ethservice=qn30b
	recode ethservice (1=4) (2=3) (3=2) (4=1) (8=.) (9=.)
	label variable ethservice "4 Very Often, 3 Fairly, 2 Once in a While, 1 Never"

* Ethnic Government Service

gen ethgovserv=qn30c
	recode ethgovserv (1=4) (2=3) (3=2) (4=1) (8=.) (9=.)
	label variable ethgovserv "4 Very Often, 3 Fairly, 2 Once in a While, 1 Never"

egen ethscale = rsum(ethrespect ethservice ethgovserv)

* Bias Question

gen bias=qn29
	recode bias (1=2) (2=0) (8=1) (9=.)
	label variable bias "2 Yes, 1 Don't Know, 0 No"


****************************************************************
*
*				Extra Items for Imputing and Matching			*
*
****************************************************************



* Not hired or promoted due to ethnicity

gen promote=qn31
	recode promote (1=1) (2=3) (8=2) (9=.)
	label variable promote "1 Yes, 2 Don't Know, 3 No"

* What party has more concern for Latinos?

gen concern=qn13
	recode concern (1=1) (8=2) (3=2) (2=3) (9=.)
	label variable concern "1 Democrat, 2 Don't Know or No Diff, 3 Republican"

* Read in Spanish

gen spkspan=qn34
	recode spkspan (1=1) (2=2) (3=3) (4=4) (8=.) (9=.)
	label variable spkspan "1 very well, 2 pretty well, 3 just a little, 4 not at all"

gen rdspan=qn35
	recode rdspan (1=1) (2=2) (3=3) (4=4) (8=.) (9=.)
	label variable rdspan "1 very well, 2 pretty well, 3 just a little, 4 not at all"

gen spkenglish=qn36
	recode spkenglish (1=1) (2=2) (3=3) (4=4) (8=.) (9=.)
	label variable spkenglish "1 very well, 2 pretty well, 3 just a little, 4 not at all"

gen rdenglish=qn37
	recode rdenglish (1=1) (2=2) (3=3) (4=4) (8=.) (9=.)
	label variable rdenglish "1 very well, 2 pretty well, 3 just a little, 4 not at all"



**********************************************************************************

* Keep the variables to use in the matching analysis

keep pid2 bias ethgovserv ethservice ethrespect discrimwork discrimschools discrimgeneral citizen married age incomecats education USborn USPRborn spdominant female amount employed region adults rdspan rdenglish spkspan spkenglish promote concern discrimscales ethscales

save 2007LatinoSurvey_edited_for_matching_in_R.dta, replace 
